package Q_Learning;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;

import javax.swing.*;

public class GridPanel extends JPanel {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	public JLabel[] direction;
	public JLabel center;
	public static final String[] dir = 
		{BorderLayout.NORTH,
		BorderLayout.EAST,
		BorderLayout.SOUTH,
		BorderLayout.WEST};
	
	public GridPanel( int x, int y){
		super();
		BorderLayout gridLayout = new BorderLayout( 10, 10);
		this.setLayout(gridLayout);
		this.setBorder(BorderFactory.createLineBorder(Color.BLACK));
		this.setPreferredSize(new Dimension(150, 150) );
		this.setMinimumSize(new Dimension(150, 150));
		direction = new JLabel[Qtable.Actionmax];
		for ( Action a : Action.values() ){
			direction[a.type] = new JLabel("0.0", SwingConstants.CENTER);
			this.add(direction[a.type], dir[a.type]);
		}
		center = new JLabel(x+","+y, SwingConstants.CENTER);
		this.add(center, BorderLayout.CENTER);
	}
}
